Skip to content

Comments

plugin: minor improvements to logic, variable initialization#817

Merged
mergify[bot] merged 3 commits intoflux-framework:masterfrom
cmoussa1:priority.plugin.improvements
Feb 18, 2026
Merged

plugin: minor improvements to logic, variable initialization#817
mergify[bot] merged 3 commits intoflux-framework:masterfrom
cmoussa1:priority.plugin.improvements

Conversation

@cmoussa1
Copy link
Member

Problem

There are few minor issues in the priority plugin:

  • In check_and_release_held_jobs (), held_job_id is not set in the case where removing the max_sched_jobs dependency fails, which is inconsistent with the other checks throughout this function.
  • The goto error block is unconditionally executed at the end of check_and_release_held_jobs () because there is no return statement before the label, even on success. This incorrectly populates the journal with error messages, even if the function succeeds.
  • In run_cb (), the held_jobs attribute for an Association object is not checked to see if it is empty before calling check_and_release_held_jobs ().

This PR includes minor fixes for all three problems listed above.

Problem: In check_and_release_held_jobs (), held_job_id is not set in
the case where removing the max_sched_jobs dependency fails, which is
inconsistent with the other checks throughout this function.

Add the initialization of held_job_id in the if-branch check for
removing the max_sched_jobs dependency from a held job.
Problem: The "goto error" block is unconditionally executed at the end
of check_and_release_held_jobs () because there is no "return" statement
before the label, even on success. This incorrectly populates the
journal with error messages, even if the function succeeds.

Add a "return 0" call before the label.
Problem: In run_cb (), the held_jobs attribute for an Association object
is not checked to see if it is empty before calling
check_and_release_held_jobs ().

Check to see that it has at least one entry in it before calling
check_and_release_held_jobs ().
@cmoussa1 cmoussa1 added improvement upgrades to an already existing feature plugin related to the multi-factor priority plugin labels Feb 17, 2026
Copy link
Member

@jameshcorbett jameshcorbett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! One question

Comment on lines 380 to 390
return 0;
error:
flux_jobtap_raise_exception (p,
held_job_id,
"mf_priority",
0,
"check_and_release_held_jobs: failed to "
"remove %s dependency from job %ju",
dependency.c_str (),
held_job_id);
return -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised this issue wasn't noticed before. Without the return 0 added here, wouldn't every job have this exception raised?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly 🤦 this floods the journal with these exception messages. I think I've mentioned it in a meeting or two a while ago that inspecting the log showed so many of these messages, even though nothing was wrong. Now I know why 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't there be job failures though in addition to just the log messages?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see what you're saying. Well, I actually think in the case that removing any and all dependencies succeeds and everything proceeds normally, held_job_id (the variable passed in to flux_jobtap_raise_exception) remains 0, so the job itself would not fail, but I'm pretty sure any callback that called this function would get a return value of -1. Does that make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh got it! Makes sense.

@cmoussa1
Copy link
Member Author

Thanks for the review @jameshcorbett! Setting MWP here

@mergify mergify bot added the queued label Feb 18, 2026
@mergify mergify bot merged commit ad4a397 into flux-framework:master Feb 18, 2026
14 of 16 checks passed
@mergify
Copy link
Contributor

mergify bot commented Feb 18, 2026

Merge Queue Status

Rule: default


  • Entered queue2026-02-18 00:50 UTC
  • Checks passed · in-place
  • Merged2026-02-18 00:50 UTC · at 8a3d80475628c674af897eefb25a7f471bd15ee8

This pull request spent 5 seconds in the queue, with no time running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = coverage
    • check-neutral = coverage
    • check-skipped = coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = el8 - distcheck
    • check-neutral = el8 - distcheck
    • check-skipped = el8 - distcheck
  • any of [🛡 GitHub branch protection]:
    • check-success = el8 - py3.6
    • check-neutral = el8 - py3.6
    • check-skipped = el8 - py3.6
  • any of [🛡 GitHub branch protection]:
    • check-success = jammy - py3.6
    • check-neutral = jammy - py3.6
    • check-skipped = jammy - py3.6
  • any of [🛡 GitHub branch protection]:
    • check-success = spelling
    • check-neutral = spelling
    • check-skipped = spelling
  • any of [🛡 GitHub branch protection]:
    • check-success = python format
    • check-neutral = python format
    • check-skipped = python format
  • any of [🛡 GitHub branch protection]:
    • check-success = python lint
    • check-neutral = python lint
    • check-skipped = python lint
  • any of [🛡 GitHub branch protection]:
    • check-success = validate commits
    • check-neutral = validate commits
    • check-skipped = validate commits

@mergify mergify bot removed the queued label Feb 18, 2026
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.62%. Comparing base (fa19831) to head (8a3d804).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/plugins/mf_priority.cpp 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #817      +/-   ##
==========================================
- Coverage   82.93%   82.62%   -0.32%     
==========================================
  Files          27       27              
  Lines        2479     2480       +1     
==========================================
- Hits         2056     2049       -7     
- Misses        423      431       +8     
Files with missing lines Coverage Δ
src/plugins/mf_priority.cpp 81.84% <50.00%> (-1.21%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement upgrades to an already existing feature merge-when-passing plugin related to the multi-factor priority plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants